<html xmlns:wicket="http://wicket.apache.org/">
<head>
	<wicket:panel>
<script type="text/javascript" charset="UTF-8" src="lumis/portal/client/script/LumisPortalUtil.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/wicket-event.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/wicket-ajax.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/jquery-1.4.2.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/jquery-ui-1.8.custom.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/jquery.layout-1.3.0.rc29.3.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/LumisDragDrop.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/LumisContextMenu.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/LumisChannelTree.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/LumisServiceInterfaceList.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/LumisServiceInterfaceListHeader.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/LumisPage.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/LumisServiceInterface.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/LumisPageHolder.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/jquery.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/portalstudio/client/script/lib.js"></script>
<script type="text/javascript" charset="UTF-8" src="lumis/tool/jquery/plugins/jquery-contextmenu/jquery.contextmenu.js"></script>

	<wicket:component class="lumis.portal.presentation.perspective.publisher.PublisherLumItemIdInjectorComponent" />
	<script type="text/javascript">
	var LumICECurrentMenu;
	(function($){
	$(document).ready(function() {
		// hides the dropdown as soon as the DOM is ready
		// (a little sooner than page load)
		$('#lumbar ul.menu_dd li ul.dd').hide();
		// shows dropdown on hovering 
		$("#lumbar ul.menu_dd").hover(function() {
			$('#lumbar ul.menu_dd li a').addClass('selected');
			$("#lumbar ul.menu_dd li ul.dd").slideDown(200);
		}, function() {
			$('#lumbar ul.menu_dd li a').removeClass();
			$("#lumbar ul.menu_dd li ul.dd").hide();
		});

		$.contextMenu.theme='xp';
		lumisProcessInContextEditElements();		
	});

	function lumisProcessInContextEditElements()
	{
		lumisProcessInContextEditAttributes("lumis:interface-instance", "ii", "cLumICEOverlayII");
		lumisProcessInContextEditAttributes("lumis:content", "itemId", "cLumICEOverlayC");
	}

	function lumisProcessInContextEditAttributes(attrName, paramName, overlayClass)
	{
		var prevPositions = "";
		var showingMenu = false;
		var curMenu = null;
		var selectorAttrName = attrName.replace(":", "\\:");
		
		// select all interface in-context-edit enabled
		$("*").filter(function(){
			var attr;
			try
			{
				attr = this.getAttribute(attrName);	
			}
			catch(e)
			{
				attr = null;
			}
			return attr;
			})
			.each(function(index){
			var value = $(this).attr(attrName);
			$(this).removeAttr(attrName);
			if (value == "false") 
				return;
			
			var prependToElement = $(this);
			
			var positionStr = "";
			if(prependToElement.position())
			{
				var left = prependToElement.position().left;
				var paddingLeft = prependToElement.css("padding-left");
				if(paddingLeft != null && paddingLeft.length > 0)
				{
					left = left + parseFloat(paddingLeft);
				}
				
				var top = prependToElement.position().top;
				var paddingTop = prependToElement.css("padding-top");
				if(paddingTop != null && paddingTop.length > 0)
				{
					top = top + parseFloat(paddingTop);
				}
				
				positionStr = 'left:' + left + 'px;top:' + top + 'px;';
			}
			
			var $marker = $('<div class="' + overlayClass + '" style="position:absolute;z-index:200;' + positionStr + '"></div>');
			prependToElement.prepend($marker);
			
			var iWidth = 10;
			if(prependToElement.width() > 10)
				iWidth = prependToElement.width();
			
			var iHeight = 10;
			if(prependToElement.height() > 10)
				iHeight = prependToElement.height();
			
			function expandMarker(ignoreShowingMenu){
				if (!(ignoreShowingMenu == true) && showingMenu) 
					return;
				$marker.stop().animate({
					width: iWidth,
					height: iHeight
				}, {
					duration: 400
				});
			};
			
			function contractMarker(ignoreShowingMenu){
				if (!(ignoreShowingMenu == true) && showingMenu) 
					return;
				$marker.stop().animate({
					width: 10,
					height: 10
				}, {
					duration: 200
				});
			};
			
			$marker.fadeTo(0, 0.5);
			$marker.hover(expandMarker, contractMarker);
			
			prependToElement.contextMenu(function(){
				showingMenu = true;
				var menu = new Array();
				$.ajax({
					type: "POST",
					url: "lumis/portal/controller/xml/InContextMenuControllerXml.jsp?" + paramName + "=" + encodeURIComponent(value) + "&lumPageId=" + g_LumisPageId + "&lumItemId=" + encodeURIComponent(lumPubLumItemId),
					dataType: "xml",
					async: false,
					success: function(data){
						var title = $(data).find("title").text();
						var curMenu = {};
						curMenu[title] = {
							onclick: function(){
							},
							disabled: true,
							className: 'context-menu-title'
						};
						menu[0] = curMenu;
						menu[1] = $.contextMenu.separator, $(data).find("item").each(function(){
							var menuScript = $(this).text();
							var curMenu = {};
							curMenu[$(this).attr('name')] = {
								onclick: function(){
									eval(menuScript);
								},
								icon: $(this).attr('icon')
							};
							menu[menu.length] = curMenu;
						});
					}
				});
				return menu;
			}, {
				showTransition: 'fadeIn',
				beforeShow: function(){
					if (LumICECurrentMenu != null) 
						LumICECurrentMenu.hide();
					LumICECurrentMenu = this;
				},
				showCallback: function(){
					showingMenu = true;
					expandMarker(true);
					return true;
				},
				hideTransition: 'fadeOut',
				hideCallback: function(){
					showingMenu = false;
					contractMarker(true);
				}
			});
		});
	}
	
	})(jQuery);
	</script>
<!--[if IE 6]>
<script type="text/javascript" src="lumis/portalstudio/client/script/pngfix.ie6.min.js"></script>
<script type="text/javascript">DD_belatedPNG.fix('#lumbar div, #lumbar a, #lumbar img');</script>
<![endif]-->
<script type="text/javascript">jQuery.noConflict(true)</script>
<link rel="shortcut icon" href="lumis/portal/client/images/lumis16x16.ico" type="image/x-icon" />
	</wicket:panel>
</head>
<body>
</body>
</html>